<%--

<!------------------------------------------------------------------------------
 - Copyright 2006 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   ROLE_GROUP
 - AUTHOR           :   Victor Zheng 
 - DATE CREATE      :   2006/02/01
 - DESCRIPTION      :   a PAGE-EDIT CONTENT JSP file for the function, ROLE_GROUP
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2006/02/01   Victor Zheng    1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page  import="com.erp.app.admin.roleGroupSetup.web.RoleGroupAction" %>
<%@ page  import="com.erp.app.admin.roleGroupSetup.web.RoleGroupRow" %>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="roleGroupForm" scope="session" type="com.erp.app.admin.roleGroupSetup.web.RoleGroupForm" />

<%
ArrayList roleGroupList = roleGroupForm.getMultiRows();
pageContext.setAttribute("roleGroupList", roleGroupList);
rowReadOnly = false;
TableSchema ts = roleGroupForm.getTs();
%>

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>
	}

</script>

<body onLoad="javascript:doLoad();autofill_init();">
<html:form action="/roleGroup">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>

<table class="table_top">

<tr>
	<td>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_CLEAR%>"
			styleClass="button1"/>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_ADD_ROW%>"
			styleClass="button1"/>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_SAVE%>"
			styleClass="button1"/>
		<chtml:button form="roleGroupForm" pageEvent="<%=RoleGroupAction.ACTION_REFRESH%>"
			styleClass="button1"/>
	</td>
</tr>

<tr>
	<td>

		<table class="table_crit">

		<tr class="col_label"> 
			<td class="col_label">&nbsp;</td>
			<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_FROM");
				%>
				<%=webLabel%>
			</td>
			<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_TO");
				%>
				<%=webLabel%>
			</td>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_ROLE_GROUP_ID");
			%>
			<td class="col_label">
			*<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text property="srchRoleGroupIdFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<td class="col_value">
				<html:text property="srchRoleGroupIdTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
		</tr>	
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_DESCRIPTION");
			%>
			<td class="col_label">
			*<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text property="srchDescriptionFr" styleClass="textbox1" maxlength="<%=srchColLongSize%>" size="<%=srchDisplayLongSize%>"/>
			</td>
			<td class="col_value">
				<html:text property="srchDescriptionTo" styleClass="textbox1" maxlength="<%=srchColLongSize%>" size="<%=srchDisplayLongSize%>"/>
			</td>
		</tr>		
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_STATUS");
			%>
			<td class="col_label">
			*<%=webLabel%>
			</td>
			<td class="col_value">
				<select name="srchStatus" <%=formReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">
					<%where = " TYPE = '" +  ProjectConstants.CONSTANT_TYPE_ACT_INACT + "' ";%>
					<option value="">
					<chtml:options table="T_SYS_CONSTANTS"
					valuecolumn="CONSTANT_CODE"
					textcolumn="CONSTANT_NAME"
					where= "<%=where%>"
					order="CONSTANT_NAME"
					selected="<%=roleGroupForm.getSrchStatus()%>"
					 />
				</select>
			</td>
			<td class="col_value">
				&nbsp;
			</td>
		</tr>


		</table>

	</td>
</tr>

<tr>
	<td><font color='red'><html:errors/></font></td>
</tr>

<tr>
	<td class="grid_page">
	<%if(roleGroupForm.getTotalPage() == 0 ) { %>
		&nbsp;
	<%} else { %>
		<input type="button" value="Go" class="button1" onClick="javascript:doSubmit('<%=roleGroupForm.ACTION_SCROLL_TO%>');" >
		Page
		<html:text property="scrollTo" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="4" size="4" value="<%=String.valueOf(roleGroupForm.getCurrentPage())%>"/>
		of <%=roleGroupForm.getTotalPage()%>
	<%} %>
		<input type="button" value="|&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=roleGroupForm.ACTION_SCROLL_TO_FIRST_PAGE%>');" <%=roleGroupForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=roleGroupForm.ACTION_SCROLL_LEFT%>');" <%=roleGroupForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&gt;&gt;" class="button1" onClick="javascript:doSubmit('<%=roleGroupForm.ACTION_SCROLL_RIGHT%>');" <%=roleGroupForm.getSidx() < Integer.parseInt(roleGroupForm.getLastPageSidx()) ? "" : "disabled"%>>
		<input type="button" value="&gt;&gt|" class="button1" onClick="javascript:doSubmit('<%=roleGroupForm.ACTION_SCROLL_TO_LAST_PAGE%>');" <%=roleGroupForm.getSidx() < Integer.parseInt(roleGroupForm.getLastPageSidx()) ? "" : "disabled"%>>
	</td>
</tr>

</table>


<table class="table_short_grid">

	<tr class="grid_header">
<%--
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_DELETE");
		%>
		<td class="grid_header_col_narrow" nowrap>
			<%=webLabel%>
		</td>
--%>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_ROLE_GROUP_ID");
		%>
		<td class="grid_header_col" nowrap>
			<bean:message key="label.general.mandatory.field"/>
			<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_DESCRIPTION");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_STATUS");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_SHOW_COST");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
	</tr>

	<logic:iterate id="roleGroupRow" name="roleGroupList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(roleGroupForm.getSidx())%>">

	<%
		RoleGroupRow row = (RoleGroupRow) roleGroupRow;
	%>

	<% if(row != null) {%>

	<tr <%=(idx.intValue()%2 == 0)? "class='grid_result1'": "class='grid_result2'"%>> 
<%--
		<td nowrap>
			<html:checkbox property="isDelete" name="roleGroupRow" value="<%= row.getIdx()%>" styleClass="checkbox1" disabled="<%=rowReadOnly%>" />
		</td>
--%>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_ROLE_GROUP_ID"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_ROLE_GROUP_ID"));
			%>
			<logic:equal name="roleGroupRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<html:text property="roleGroupId" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getRoleGroupId())%>"/>
			</logic:equal>
			<logic:notEqual name="roleGroupRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<bean:write name="roleGroupRow" property="roleGroupId" filter="true"/>
				<html:hidden property="roleGroupId" value="<%=CommonUtil.nullToString(row.getRoleGroupId())%>"/>
			</logic:notEqual>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_DESCRIPTION"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_DESCRIPTION"));
			%>
			<html:text property="description" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getDescription())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_STATUS"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_STATUS"));
			%>
			<select name="status" <%=formReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">
				<%where = " TYPE = '" +  ProjectConstants.CONSTANT_TYPE_ACT_INACT + "' ";%>
				<option value="">
				<chtml:options table="T_SYS_CONSTANTS"
				valuecolumn="CONSTANT_CODE"
				textcolumn="CONSTANT_NAME"
				where= "<%=where%>"
				order="CONSTANT_NAME"
				selected="<%=row.getStatus()%>"
				 />
			</select>
		</td>
		<td nowrap>
			<select name="showCost" <%=rowReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">			
			    <option value="<%=ProjectConstants.GENERIC_YES%>" <%=CommonUtil.nullToString(row.getShowCost()).equals(ProjectConstants.GENERIC_YES)?"selected":""%>><%=ProjectConstants.GENERIC_YES%></OPTION>
				<option value="<%=ProjectConstants.GENERIC_NO%>" <%=CommonUtil.nullToString(row.getShowCost()).equals(ProjectConstants.GENERIC_NO)?"selected":""%>><%=ProjectConstants.GENERIC_NO%></OPTION>
	        </select>
		</td>
	</tr>

	<% } // end if(row != null) %>

	<html:hidden property="idx" value="<%=row.getIdx()%>" />
	<html:hidden property="rowMode"  value="<%=row.getRowMode()%>"/>

	</logic:iterate>

</table>

</html:form>
